package com.analysis.service;

import com.analysis.entity.Version;
import com.analysis.mapper.VersionMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class VersionService {

    @Autowired
    private VersionMapper versionMapper;

    public int create(Version version) {
        return versionMapper.insert(version);
    }

    public int delete(Long id) {
        return versionMapper.deleteById(id);
    }

    public int update(Version version) {
        return versionMapper.update(version);
    }

    public Version getById(Long id) {
        return versionMapper.selectById(id);
    }

    public List<Version> listAll() {
        return versionMapper.selectAll();
    }

    public Version getByName(String name) {
        return versionMapper.selectByName(name);
    }

    public Version getVersionsByCompanyId(Long companyId) {
        return versionMapper.selectVersionsByCompanyId(companyId);
    }

    public List<Version> listVersionsByCompanyId(Long companyId) {
        return versionMapper.listVersionsByCompanyId(companyId);
    }
}


